package com.example.demo.controller;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.example.demo.entity.User;
import com.example.demo.hystrix.DemoRemoteHystrix;

/**
 *  Created by yinyonggang on 2018/7/25.
 */
@FeignClient(name = "sever-provider", fallback = DemoRemoteHystrix.class)
public interface FeignInterfaceClient {
	
    @RequestMapping(value = "/feigns/getRequest", method = RequestMethod.GET)
    String getRequest();
    
    @RequestMapping(value = "/feigns/postRequest", method = RequestMethod.POST)
    String postRequest();

    /**
	 * post请求带参数
	 * @param user
	 * @return
	 */
    @RequestMapping(value = "/feigns/postRequestByParam", method = RequestMethod.POST)
    String postRequestByParam(@RequestBody(required = false) User user);
    
    /**
	 * post请求带参数
	 * @param pageNum
	 * @return
	 */
    @RequestMapping(value = "/feigns/requestParam", method = RequestMethod.POST)
    int requestParam(@RequestParam(value = "pageNum") int pageNum);
}
